package com.babel.util.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RedisUtils {

	private static RedisManage redisManage;

	@Autowired
	public void setRedisManage(RedisManage redisManage){
		RedisUtils.redisManage = redisManage;
	}
    
	public static Object get(String key){
    	return redisManage.get(key);
    }
	
	public static void set(String key,Object value){
		redisManage.set(key, value);
    }
	
	public static void set(String key,Object value,long timeout){
		redisManage.set(key, value, timeout);
	}
	
    public static void delete(String key){
    	redisManage.delete(key);
    }
    
    public static boolean setNX(String key,long timeout,Object value){
    	return redisManage.setNX(key, timeout, value);
    }
    
    public static void setbit(String key,long offset,boolean value){
    	redisManage.setbit(key, offset, value);
    }
    
    public static Boolean getbit(String key,long offset){
    	return redisManage.getbit(key, offset);
    }
}